package cm.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * @Auther: yxh
 * @Description: 导出类型枚举
 * @Date: Created in 2022/8/18 10:42
 * @Modified By:
 */
public enum ExportTypeEnum {

    CSV("CSV", "application/csv"),
    XLSX("XLSX", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"),
    XLS("XLS","application/vnd.ms-excel"),
    DOC("DOC", "application/msword"),
    DOCX("DOCX ", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"),
    PDF("PDF","application/pdf");

    private String code;
    private String value;

    ExportTypeEnum(String code, String value) {
        this.code = code;
        this.value = value;
    }

    public String getCode() {
        return code;
    }

    public String getValue() {
        return value;
    }

    private static Map<String,ExportTypeEnum> enumMap = new HashMap<>();

    static {
        for (ExportTypeEnum value : ExportTypeEnum.values()) {
            enumMap.put(value.getCode(),value);
        }
    }

    public static String find(String code){
        return enumMap.get(code).getValue();
    }
}
